<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserRegistrationForm
 *
 * @author Animus Inc.
 */

// Restrict Unrestricted Access

defined("_dispatch") or	die("Access Denied !");

// Constants

define('DOMROOT', dirname(dirname(__FILE__)));

// Imports
require_once DOMROOT.'/classes/FormsAPI/Form.php';
require_once DOMROOT.'/classes/FormsAPI/TextField.php';
require_once DOMROOT.'/classes/FormsAPI/EmailField.php';
require_once DOMROOT.'/classes/FormsAPI/PasswordField.php';

class UserRegistrationForm extends Form{
    
    public function __construct() {
        
        parent::__construct("UserRegistrationForm", "UserRegistrationForm", "UserRegistrationForm", "");
        
        $fname = new TextField("_fname");
        $fname->isRequired();
        $fname_handler = $fname->getHTMLHandler();
        $attrs_fname = array("name" => $fname->getName(), "class" => "_fname", "id" => "_fname");
        $fname_handler->setAttrs($attrs_fname);
        $fname_handler->setLabel("First Name : ");

        $lname = new TextField("_lname");
        $lname->isRequired();
        $lname_handler = $lname->getHTMLHandler();
        $attrs_lname = array("name" => $lname->getName(), "class" => "_lname", "id" => "_lname");
        $lname_handler->setAttrs($attrs_lname);
        $lname_handler->setLabel("Last Name : ");
        
        $pass = new PasswordField("_pass");
        $pass->isRequired();
        $pass_handler = $pass->getHTMLHandler();
        $attrs_pass = array("name" => $pass->getName(), "class" => "_pass", "id" => "_pass");
        $pass_handler->setAttrs($attrs_pass);
        $pass_handler->setLabel("Password : ");
        
        $email = new EmailField("_email");
        $email->isRequired();
        $email_handler = $email->getHTMLHandler();
        $attrs_email = array("name" => $email->getName(), "class" => "_email", "id" => "_email");
        $email_handler->setAttrs($attrs_email);
        $email_handler->setLabel("Email : ");
        // create an instance of form class and set the method = POST
        
        
        parent::setMethod("POST");
        
        // set the target to the form
        
        parent::setTarget("/stockworldmarket/new-user/register/submit.php");
        
        // add the Fields to the form
        
        parent::addField($fname);
        parent::addField($lname);
        parent::addField($email);
        parent::addField($pass);

        return parent;
        
    }
    
    public function setFieldValue($key, $value) {
      
        parent::setFieldValue($key, $value);
    }
    
    public function setCommonError($_error){
        
        parent::setCommonError($_error);
    }
	    
    public function validate(){
        
       return parent::validate();
       
    }

    public function handleSubmit($args){
	
       return parent::handleSubmit($args);
  
    }
    
}

?>
